// 1.0 导入vue核心包
import Vue from 'vue';

// 2.0 导入App.vue的vue对象
import App from './App.vue';

// 3.0 将vue-router集成到这个项目中来
import vueRouter from 'vue-router';

// 3.0.1 将vueRouter对象绑定到Vue对象上
Vue.use(vueRouter);

// 3.0.2 导入路由规则对应的组件对象
import shopcar from './components/shopcar/car.vue';
import home from './components/Home.vue';
import newslist from './components/news/newslist.vue';
import photolist from './components/photo/photolist.vue';
import newsinfo from './components/news/newsinfo.vue';
import photoinfo from './components/photo/photoinfo.vue';
import goodslist from './components/goods/goodslist.vue';
import goodsinfo from './components/goods/goodsinfo.vue';
import goodsdesc from './components/goods/goodsdesc.vue';
import goodscomment from './components/goods/goodscomment.vue'

// 3.0.2 定义路由规则
var router=new vueRouter({
	linkActiveClass:'mui-active',
	routes:[
		{path:'/',redirect:'/home'},
		{path:'/shopcar',component:shopcar},//购物车
		{path:'/home',component:home},//首页
		{path:'/news/newslist',component:newslist},//新闻列表页面
		{path:'/photo/photolist',component:photolist},//照片列表页面
		{path:'/news/newsinfo/:id',component:newsinfo},//新闻详情页面
		{path:'/photo/photoinfo/:id',component:photoinfo},//照片列表页面
		{path:'/goods/goodslist',component:goodslist},//商品列表页面
		{path:'/goods/goodsinfo/:id',component:goodsinfo},//商品详情列表页面
		{path:'/goods/goodsdesc/:id',component:goodsdesc},//商品详情
		{path:'/goods/goodscomment/:id',component:goodscomment},//商品详情
	]
})
// 4.0 引入mint-ui组件
import Mint from 'mint-ui';
import 'mint-ui/lib/style.css';
import '../statics/css/mui.min.css';

// 6.0 导入一个当前系统的全局基本样式
import '../statics/css/site.css';

// 7.0 导入一个moment时间处理JS库
import moment from 'moment';
Vue.filter('datefmt',function(input,fmtstring){
	return moment(input).format(fmtstring);
});

// 4.1 mint绑定到vue上
Vue.use(Mint);

import VuePreview from './vue-preview.min.js';
Vue.use(VuePreview);
Vue.use(VuePreview, {
  mainClass: 'pswp--minimal--dark',
  barsSize: {top: 0, bottom: 0},
  captionEl: false,
  fullscreenEl: false,
  shareEl: false,
  bgOpacity: 0.85,
  tapToClose: true,
  tapToToggleControls: false
})
// 5.0 利用Vue对象进行解析渲染
new Vue({
	el:'#app',
	// 使用路由对象实例
	router,
	// render:function(create){create(App)} //es5的写法
	render:c=>c(App)  // es6的函数写法 =>：goes to
});